package com.ruoyi.exa.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.exa.mapper.ExaBitchUserQuestionsMapper;
import com.ruoyi.exa.domain.ExaBitchUserQuestions;
import com.ruoyi.exa.service.IExaBitchUserQuestionsService;

/**
 * 答题卡Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-07-25
 */
@Service
public class ExaBitchUserQuestionsServiceImpl implements IExaBitchUserQuestionsService
{
    @Autowired
    private ExaBitchUserQuestionsMapper exaBitchUserQuestionsMapper;

    /**
     * 查询答题卡
     * 
     * @param id 答题卡主键
     * @return 答题卡
     */
    @Override
    public ExaBitchUserQuestions selectExaBitchUserQuestionsById(Long id)
    {
        return exaBitchUserQuestionsMapper.selectExaBitchUserQuestionsById(id);
    }

    /**
     * 查询答题卡列表
     * 
     * @param exaBitchUserQuestions 答题卡
     * @return 答题卡
     */
    @Override
    public List<ExaBitchUserQuestions> selectExaBitchUserQuestionsList(ExaBitchUserQuestions exaBitchUserQuestions)
    {
        return exaBitchUserQuestionsMapper.selectExaBitchUserQuestionsList(exaBitchUserQuestions);
    }

    /**
     * 新增答题卡
     * 
     * @param exaBitchUserQuestions 答题卡
     * @return 结果
     */
    @Override
    public int insertExaBitchUserQuestions(ExaBitchUserQuestions exaBitchUserQuestions)
    {
        exaBitchUserQuestions.setCreateTime(DateUtils.getNowDate());
        return exaBitchUserQuestionsMapper.insertExaBitchUserQuestions(exaBitchUserQuestions);
    }

    /**
     * 修改答题卡
     * 
     * @param exaBitchUserQuestions 答题卡
     * @return 结果
     */
    @Override
    public int updateExaBitchUserQuestions(ExaBitchUserQuestions exaBitchUserQuestions)
    {
        exaBitchUserQuestions.setUpdateTime(DateUtils.getNowDate());
        return exaBitchUserQuestionsMapper.updateExaBitchUserQuestions(exaBitchUserQuestions);
    }

    /**
     * 批量删除答题卡
     * 
     * @param ids 需要删除的答题卡主键
     * @return 结果
     */
    @Override
    public int deleteExaBitchUserQuestionsByIds(Long[] ids)
    {
        return exaBitchUserQuestionsMapper.deleteExaBitchUserQuestionsByIds(ids);
    }

    /**
     * 删除答题卡信息
     * 
     * @param id 答题卡主键
     * @return 结果
     */
    @Override
    public int deleteExaBitchUserQuestionsById(Long id)
    {
        return exaBitchUserQuestionsMapper.deleteExaBitchUserQuestionsById(id);
    }

    /**
     * 删除退出之前的答案
     *
     * @param bitchId 批次ID
     * @param userId 用户ID
     * @param parPerId 卷纸ID
     * @return 结果
     */
    @Override
    public int deleteExaBitchUserQuestionsOld(Long bitchId,Long userId,Long parPerId){
        return exaBitchUserQuestionsMapper.deleteExaBitchUserQuestionsOld(bitchId,userId,parPerId);
    }
}
